package good.threadlocalDemo;

public class MyThreadLocal extends ThreadLocal<MyThreadLocal>{
	private Integer i=0;
	public Integer getI() {
		return i;
	}
	public void setI(Integer i) {
		this.i = i;
	}
	private  MyThreadLocal() {
		
	}
	@Override
	protected MyThreadLocal initialValue() {
		return new MyThreadLocal();
	}
	public static MyThreadLocal getIntence(){
		ThreadLocal<MyThreadLocal> tl=new ThreadLocal<MyThreadLocal>();
		if(tl.get()==null){
			System.out.println("good");
			tl.set(new MyThreadLocal());
			return tl.get();
		}
		return tl.get();
	}

}
